﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EventRegistration;

public partial class UserControls_Navigation : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CurrentData.RegistrationInfo.Completed) //If user is not loggined, hide functional menu item
        {
            MainMenu.Items.FindByName("AddProduct").ClientVisible = false;
            MainMenu.Items.FindByName("AddSupplier").ClientVisible = false;
            MainMenu.Items.FindByName("Schedule").ClientVisible = false;
            MainMenu.Items.FindByName("Reports").ClientVisible = false;
            MainMenu.Items.FindByName("Logout").ClientVisible = false;
        }
        else //Otherwise, hide login and registration menu item
        {
            MainMenu.Items.FindByName("Login").ClientVisible = false;
            MainMenu.Items.FindByName("Registration").ClientVisible = false;
            MainMenu.Items.FindByName("AddProduct").ClientVisible = true;
            MainMenu.Items.FindByName("AddSupplier").ClientVisible = true;
            MainMenu.Items.FindByName("Schedule").ClientVisible = true;
            MainMenu.Items.FindByName("Reports").ClientVisible = true;
            MainMenu.Items.FindByName("Logout").ClientVisible = true;
        }
    }
}
